import request from "@/utils/request"
import type { categoryListModel } from "./model/categoryModel";

enum API{
  // GET /admin/product/getCategory1
  category1List="/admin/product/getCategory1",
  // GET /admin/product/getCategory2/{category1Id}
  category2List="/admin/product/getCategory2",
  // GET /admin/product/getCategory3/{category2Id}
  category3List="/admin/product/getCategory3",
}

// 获取一级分类
export const category1ListApi=()=>{
  return request.get<any,categoryListModel>(API.category1List)
}
// 获取二级分类
export const category2ListApi=(category1Id:number)=>{
  return request.get<any,categoryListModel>(API.category2List+`/${category1Id}`)
}
// 获取三级分类
export const category3ListApi=(category2Id:number)=>{
  return request.get<any,categoryListModel>(API.category3List+`/${category2Id}`)
}
